home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tchk20.arc / DEMO.ARC / DEMONUM.C < prev    next >
C/C++ Source or Header  |  1989-01-13  |  1KB  |  32 lines

  1. /* demonum.c  -  used for testing TCHK number (math/accounting) functions */
  2.  
  3. #include <howard.h>
  4. #include  <mathhk.h>
  5. #include <finance.h>
  6. #include <stdio.h>
  7. #include <dos.h>             /* for argc/argv */
  8.  
  9. void main();
  10.  
  11. void main()
  12. {
  13.     extern int _argc;
  14.     extern char **_argv;
  15.     double d=123456.78901, cost=10000.0, salvage=4000.0;
  16.     int i=2, life=10, period=_argc;
  17.  
  18.     printf("round %lf to %d places: %lf\n",d,i,round(d,i));
  19.     printf("frac %lf: %lf\n\n",d,frac(d));
  20.  
  21.     printf("Cost: %lf    Salvage: %lf    Life: %d    Period: %d\n\n",cost,salvage,life,period);
  22.     printf("straight line: %lf\n",SLD(cost,salvage,life));
  23.     printf("sum year digits: %lf\n",SYD(cost,salvage,life,period));
  24.     printf("double decline: %lf\n",DDB(cost,life,period));
  25.     printf("Dep 1: %lf\n",depreciation(cost,salvage,life,period,1));
  26.     printf("Dep 2: %lf\n",depreciation(cost,salvage,life,period,2));
  27.     printf("Dep 3: %lf\n\n",depreciation(cost,salvage,life,period,3));
  28.     printf("Accum Dep 1: %lf\n",accum_dep(cost,salvage,life,period+1,1));
  29.     printf("Accum Dep 2: %lf\n",accum_dep(cost,salvage,life,period+1,2));
  30.     printf("Accum Dep 3: %lf\n",accum_dep(cost,salvage,life,period+1,3));
  31. }
  32.